$(function () {

   // 点击头像预览显示
   $('#mws-user-photo').on('click', function () {
      $('#admin-info-pic').animate({
         height: '100vh'
      }, function () {
         $('#admin-info-pic .mws-panel').animate({
            opacity: 1
         })
      })
   })

   // 关闭头像预览
   $('#admin-info-pic .btn-close').on('click', function () {
      $('#admin-info-pic .mws-panel').animate({
         opacity: 0
      }, () => {
         $('#admin-info-pic').animate({
            height: 0
         })
      })
   })

   $('#sendpic').on('change', function () {
      // 1. 拿到文件信息
      const file = this.files[0];
      const fr = new FileReader();
      fr.readAsDataURL(file);
      fr.onloadend = function () {
         // 本地显示上传的图片
         $('#admin-info-pic img').prop('src', fr['result'])
      }
   })

   // 获取用户头像
   // $.get('/adminpic/getadminpic', data => {
   //    let pic = data.pic
   //    let path = 'http://admi-yuliner.oss-cn-hangzhou.aliyuncs.com/'
   //    $('#mws-user-photo img')[0].src = path + pic[pic.length - 1].userpic
   // })
})